Table of Contents
- Getting Started
- EO.Pdf- Overview
- Installation and Deployment
- Using HTML to PDF
- Using PDF Creator- Using PDF Creator
- Getting Started
- Advanced Formatting Techniques
- Interactive Features
- Low Level Content Objects
 
- Working with Existing PDF Files
- Using in Web Application
- Advanced Topics
 
- EO.Web
- EO.WebBrowser
- EO.Wpf
- Common Topics
- Reference
| Using PdfPathContent | 
PdfPathContent is used to draw lines and shapes on a page. To use PdfPathContent, you must define the path first, then either stroke it (to create lines) or fill it (to create shapes). Follow these steps to use PdfPathContent object:
- 
              create a PdfPathContent object; //Create a new PdfPathContent EO.Pdf.Contents.PdfPathContent content = new EO.Pdf.Contents.PdfPathContent(); 
- 
              create a PdfSubPath object and set the path's starting point: //Create a new sub path and set the sub path's starting point EO.Pdf.Drawing.PdfSubPath subPath = new EO.Pdf.Drawing.PdfSubPath(); subPath.From = new EO.Pdf.Drawing.PdfPoint(100, 100); A "sub path" is a sequence of connected segments. One path can contain multiple disconnected sub paths. 
- 
              Add one or more a PdfPathSegment object into the sub path: //Draw a line from the current position to (200, 200) EO.Pdf.Drawing.PdfPathLineSegment line = new EO.Pdf.Drawing.PdfPathLineSegment(new EO.Pdf.Drawing.PdfPoint(200, 200)); subPath.Segments.Add(line); You can also add other segments such as curves or rectangles. 
- 
              Add the sub path into the path's SubPaths collection: //Add the sub path into the path content.Path.SubPaths.Add(subPath);You can create and add as many sub paths as needed; 
- 
              set the PdfPathContent's Action property to stroke or fill the path. To stroke the path, you also need to set the current stroking color and line width: //Stroke the path content.LineWidth = 1f; content.StrokingColor = new EO.Pdf.Drawing.PdfColor(Color.Red); content.Action = EO.Pdf.Contents.PdfPathPaintAction.Stroke; To fill the path, you need to set the current non-stroking color and set the Action property to Fill: //Set the non stroking color content.NonStrokingColor = new EO.Pdf.Contents.PdfColor(System.Drawing.Color.Red); //Fill the path content.Action = PdfPathPaintAction.Fill; 
- 
              Add the PdfPathContent to the page's 
              Contents collection:
              //Add the path into the page page.Contents.Add(content);
Below is the full code. The code creates a single red line from (100, 100) to (200, 200).
//Create a new document PdfDocument doc = new PdfDocument(); //Add a new page PdfPage page = doc.Pages.Add(); //Create a new PdfPathContent EO.Pdf.Contents.PdfPathContent content = new EO.Pdf.Contents.PdfPathContent(); //Create a new sub path and set the sub path's starting point EO.Pdf.Drawing.PdfSubPath subPath = new EO.Pdf.Drawing.PdfSubPath(); subPath.From = new EO.Pdf.Drawing.PdfPoint(100, 100); //Draw a line from the current position to (200, 200) EO.Pdf.Drawing.PdfPathLineSegment line = new EO.Pdf.Drawing.PdfPathLineSegment(new EO.Pdf.Drawing.PdfPoint(200, 200)); subPath.Segments.Add(line); //Add the sub path into the path content.Path.SubPaths.Add(subPath); //Stroke the path content.LineWidth = 1f; content.StrokingColor = new EO.Pdf.Drawing.PdfColor(Color.Red); content.Action = EO.Pdf.Contents.PdfPathPaintAction.Stroke; //Add the path into the page page.Contents.Add(content); //Save the document doc.Save("hello.pdf");

